package com.aplikata.evok.datamodel;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import com.aplikata.evok.bo.TherapyService;
import com.aplikata.service.PublicService;
import com.aplikata.util.StringUtil;


/** 
* @ClassName: TherapyServiceDataModel 
* @Description: TODO
* @author Huyun
* @date May 30, 2012 10:45:58 AM 
*  
*/
public class TherapyServiceDataModel extends ListDataModel<TherapyService> implements SelectableDataModel<TherapyService> {
	private PublicService publicService;

	public TherapyServiceDataModel() {
	}

	public TherapyServiceDataModel(PublicService publicService, List<TherapyService> data) {
		super(data);
		this.publicService = publicService;
	}

	@Override
	public TherapyService getRowData(String arg0) {
		if (StringUtil.isStrEmpty(arg0) || "null".equals(arg0))
			return null;

		return (TherapyService) publicService.get(TherapyService.class, Long.parseLong(arg0));
	}

	@Override
	public Object getRowKey(TherapyService service) {
		return service.getId();
	}

	public PublicService getPublicService() {
		return publicService;
	}

	public void setPublicService(PublicService publicService) {
		this.publicService = publicService;
	}

}